/*
 * @lc app=leetcode.cn id=136 lang=javascript
 *
 * [136] 只出现一次的数字
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @return {number}
 */
var singleNumber = function (nums) {
  let myMap = new Map();
  for (const num of nums) {
    if (myMap.has(num)) {
      myMap.set(num, -1);
    } else {
      myMap.set(num, 1);
    }
  }
  for (let [key, value] of myMap) {
    if (value === 1) {
      return key;
    }
  }
};
// @lc code=end
